﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using UI.ServiceReference1;
using Webdiyer.WebControls.Mvc;
namespace UI.Controllers
{
    public class peopleController : Controller
    {
        ServiceReference1.WebService1SoapClient client = new ServiceReference1.WebService1SoapClient();
        //
        // GET: /people/

        public ActionResult chang(string userName, int pageIndex = 1)
        {

            int pageSize;
            pageSize = 5;
            int zongCount;
            List<ServiceReference1.Usertab_Role> userShow = client.userShow(pageIndex, pageSize, userName, out  zongCount).ToList();
            ViewBag.zongCount = zongCount;
            ViewBag.userIndex = pageIndex;
            ViewBag.userSize = pageSize;
            ViewBag.usercount = userShow.Count();
            ViewBag.weiyYe = (zongCount + pageSize - 1) / pageSize;
            ViewBag.userShow = userShow;
            List<ServiceReference1.Usertab_Role> chalist = client.showRole().ToList();
            ViewBag.list = chalist;
            return View();
        }
        public ActionResult tui()
        {
            ViewBag.list = client.tuixiu();
            return View();
        }
        /// <summary>
        /// 查询用户
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public ActionResult xiu(int userid)
        {

            List<ServiceReference1.Usertab_Role> idlist = client.idShow(userid).ToList();
            List<ServiceReference1.Usertab_Role> chalist = client.showRole().ToList();
            ViewBag.chalist = chalist;
            ViewBag.idlist = idlist;
            return View();
        }
        /// <summary>
        /// 修改用户信息
        /// </summary>
        /// <param name="del"></param>
        /// <returns></returns>
        public int xiudo(ServiceReference1.Usertab_Role del)
        {
            int i = client.delUser(del);
            return i;
        }

        public ActionResult xin(int PageIndx = 1)
        {
            List<ServiceReference1.Staff> list = client.Ryxinxi().ToList();
            list = list.ToPagedList(PageIndx, 4);
            ViewBag.xinlist = list;
            return View();
        }
        public ActionResult charen(string Staff_Name)
        {
            var cname = client.charen(Staff_Name).ToString();
            return View();
        }

    }
}
